// 转换成时间戳更好写
// 起飞时间 + 飞行时间 - 时差 = 降落时间
// 回程时间 + 飞行时间 + 时差 = 回程降落时间

#include <iostream>
#include <algorithm>
using namespace std;

int get_time()
{
    int h1, m1, s1, h2, m2, s2, d = 0;
    scanf("%d:%d:%d %d:%d:%d (+%d)", &h1, &m1, &s1, &h2, &m2, &s2, &d);
    return h2 * 3600 + m2 * 60 + s2 + 3600 * 24 * d - h1 * 3600 - m1 * 60 - s1; 
}


int main()
{
    int T;
    cin >> T;
    for(int i = 0; i < T; ++i)
    {

        int time1 = get_time();
        int time2 = get_time();
        int tmp = time1 + time2 >> 1;
        int hour = tmp / 3600;
        int min = tmp % 3600 / 60;
        int second = tmp % 60;
        printf("%02d:%02d:%02d\n", hour, min, second);
    }
    return 0;
}